<script setup lang="ts">
defineProps<{
  item: FlowPathTemplateApi.AttributeExtendDto;
}>();
</script>
<!--8-手写签名 -->
<template>
  <!--只读 -->
  <template v-if="item.readonlyAble === 1">
    <nut-cell :title="item.attributeName">
      <template #link>
        <app-upload-signature
          height="80px"
          class="app-upload-signature"
          :readonly="true"
          :default-image-url="item.attributeValue"
        />
      </template>
    </nut-cell>
  </template>
  <!--编辑 -->
  <template v-else>
    <nut-form-item
      :label="item.attributeName"
      :required="item.attributeRequired === 1"
      :label-width="120"
    >
      <app-upload-signature
        height="80px"
        signPage="/pages/my-approve/sign/index?event=onCanvas"
        event="onCanvas"
        module="approved"
        class="approve-edit-sign__signature"
        @on-change="
          (imageUrl) => {
            item.attributeValue = imageUrl ? imageUrl.src : '';
          }
        "
      />
    </nut-form-item>
  </template>
</template>
<style lang="scss">
.approve-edit-sign {
  //签名控件靠右
  &__signature {
    justify-content: end;
  }
}
</style>
